var base_url="http://www.metfind.com/";
function simpleLoader(from,to,data,done,fail,always,beforeSend)
{
		if(!done||done=="")
		{
			done=function(msg) 
			{
				to.html(msg)
			}
		}
		if(!fail||fail=="")
		{
			fail=function(jqXHR, textStatus) 
			{
				alert( "Error: "+textStatus );
			}
		}
		if(!always||always=="")
		{
			always=function() 
			{

			}
		}
		if(!beforeSend||beforeSend=="")
		{
			beforeSend=function(xhr)
			{
				xhr.overrideMimeType('text/html; charset=UTF-8');
				to.html('<div style="height:100px;padding-top:24px;width:100%;margin:0 auto;text-align:center"><img src="'+ base_url+'assets/images/loaders/loader2.gif"/></div>')
			
			
			}
		}
		
		var request = $.ajax({
		url: from,
		type: "POST",
		data: data,
		dataType: "html",
		contentType:'application/x-www-form-urlencoded; charset=UTF-8',
		headers: { 
        Accept : "text/plain; charset=UTF-8",
        "Content-Type": "text/plain; charset=UTF-8"
    },
		beforeSend: beforeSend
		})
		
		.done(done)
		
		.fail(fail)
		
		.always(always);	
}

function saveQE(data,url,done)
{
	beforeSend=function(xhr)
	{

		$("#container").html('<div style="height:100px;padding-top:24px;width:100%;margin:0 auto;text-align:center"><img src="'+ base_url+'assets/images/loaders/loader2.gif"/></div>')
	}
	
	var request = $.ajax({
		url: url,
		data: {'QE':data},
		type:  'post',
		dataType: 'html',
		beforeSend: beforeSend
		})
		
		.done(done)
		
		//.fail(function(){alert('fail')})
		
}


function saveEE(data,url,done)
{
	beforeSend=function(xhr)
	{

		$("#container").html('<div style="height:100px;padding-top:24px;width:100%;margin:0 auto;text-align:center"><img src="'+ base_url+'assets/images/loaders/loader2.gif"/></div>')
	}
	
	var request = $.ajax({
		url: url,
		data: {'EE':data},
		type:  'post',
		dataType: 'html',
		beforeSend: beforeSend
		})
		
		.done(done)		
		//.fail(function(){alert('fail')})	
}
function saveCO(data,url,done)
{
	beforeSend=function(xhr)
	{

		$("#container").html('<div style="height:100px;padding-top:24px;width:100%;margin:0 auto;text-align:center"><img src="'+ base_url+'assets/images/loaders/loader2.gif"/></div>')
	}
	
	var request = $.ajax({
		url: url,
		data: {'CO':data},
		type:  'post',
		dataType: 'html',
		beforeSend: beforeSend
		})
		
		.done(done)		
		//.fail(function(){alert('fail')})	
}
function saveData(url,data)
{
	beforeSend=function(xhr)
	{

		$("#container").html('<div style="height:100px;padding-top:24px;width:100%;margin:0 auto;text-align:center"><img src="'+ base_url+'assets/images/loaders/loader2.gif"/></div>')
	}
	
	var request = $.ajax({
		url: url,
		data:data,
		type:  'post',
		dataType: 'html',
		beforeSend: beforeSend
		})
		
		.done(function(){
			
			$("#container").html("<div style='text-align:center'><h1>Evaluacion enviada!</h1></div>");
		})		
		//.fail(function(){alert('fail')})	
}

